#include "mainwindow.h"
#include "Log.h"
#include "StringUtils.h"

#include <QApplication>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    MainWindow w;
    w.show();
    // 初始化日志文件
    Log::init("app.log");

    // 写入日志
    Log::writeLog(Log::Info, "Application started.");
    Log::writeLog(Log::Warning, "This is a warning message.");
    Log::writeLog(Log::Error, "This is an error message.");

    // 字符串处理示例
    QString originalStr = "  Hello, World!  ";
    QString trimmedStr = StringUtils::trim(originalStr);
    Log::writeLog(Log::Info, QString("Trimmed string: %1").arg(trimmedStr));

    QString email = "example@example.com";
    bool isValidEmail = StringUtils::isEmailValid(email);
    Log::writeLog(Log::Info, QString("Is valid email: %1").arg(isValidEmail ? "Yes" : "No"));

    return a.exec();
}
